<?php
namespace Home\Controller;
use Think\Controller;
class NewsController extends IndexController {

    function __construct()
    {
        parent::__construct();
        $this->article = M('article');

    }

    function index(){
        $articles=$this->article->limit(0, 12)->select();
        //dump($articles);exit;
        $hots = $this->article->order('view desc')->select();
        $daoshi =$this->article->limit(0, 12)->where("category_id = 2")->select();
        $yingping =$this->article->limit(0, 12)->where("category_id = 4")->select();
        //dump($daoshi);exit;
        $this->assign("daoshi",$daoshi);
        $this->assign("yingping",$yingping);
        $this->assign("hots",$hots);
        $this->assign("articles",$articles);
        //dump($articles);exit;
        $this->display();
    }
}